#-*-coding:utf-8-*-
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from material.models import elastic
# Create your views here.

def index(request):
	material_list = elastic.objects.order_by('name')
	contex = {
		'material_list' : material_list,
	}
	return render(request, 'material/index.html', contex)
def add(request, mat_name):
	return HttpResponse("材料添加")
def detail(request, mat_name):
	mat_detail = get_object_or_404(elastic, name=mat_name)
	return render(request, 'material/detail.html',{'mat_detail':mat_detail})
def update(request, mat_name):
	material = get_object_or_404(elastic, name=mat_name)
	return render(request, 'material/update.html',{'material':material})
